<?php
require ('../include/init.inc.php');
$holder_id = $holder_stock = $holder_name= '';
extract ( $_REQUEST, EXTR_IF_EXISTS );

Common::checkParam($holder_id);
$holderStock= HolderStock::getHolderStockById($holder_id);
if(empty($holderStock)){
	Common::exitWithError(ErrorMessage::HOLDER_STOCK_NOT_EXIST,"panel/holder_stocks.php");
}
if (Common::isPost ()) {
	
	if($holder_name =="" || $holder_stock =="" ){
		
		OSAdmin::alert("error",ErrorMessage::NEED_PARAM);
	}else{
		
		$update_data = array ('holder_name' => $holder_name, 'holder_stock' => $holder_stock, );
	
		
		$result = HolderStock::updateHolderStock ( $holder_id,$update_data );
		
		if ($result>=0) {
			$current_user=UserSession::getSessionInfo();
			$ip = Common::getIp();
			$update_data['ip']=$ip;
			SysLog::addLog ( UserSession::getUserName(), 'MODIFY', 'HolderStock' , $holder_id, json_encode($update_data) );
			Common::exitWithSuccess ('更新完成','panel/holder_stocks.php');
		} else {
			
			OSAdmin::alert("error");
		}
	}
}

$group_options=UserGroup::getGroupForOptions();

Template::assign ( 'holderStock', $holderStock );
Template::display ( 'panel/holder_stock_modify.tpl' );